home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / inventor / SpaceballViewer / MyColorPatch.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.9 KB  |  100 lines

  1. /*
  2.  * Copyright (c) 1990-1991, 1994 Silicon Graphics, Inc.
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that the name of Silicon Graphics may not be used in any advertising or
  7.  * publicity relating to the software without the specific, prior written
  8.  * permission of Silicon Graphics.
  9.  *
  10.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  11.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  12.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  13.  *
  14.  * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  15.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
  17.  * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  */
  20. //  -*- C++ -*-
  21.  
  22. /*
  23.  * Copyright (C) 1990,91   Silicon Graphics, Inc.
  24.  *
  25.  _______________________________________________________________________
  26.  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
  27.  |
  28.  |   $Revision: 1.1006 $
  29.  |
  30.  |   Description:
  31.  |    This file contains the class description for the MyColorPatch.
  32.  |
  33.  |   Author(s)    : Alain Dumesny
  34.  |
  35.  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
  36.  _______________________________________________________________________
  37.  */
  38.  
  39. #ifndef  _SO_XT_COLOR_PATCH_
  40. #define  _SO_XT_COLOR_PATCH_
  41.  
  42. #include <Inventor/Xt/SoXtGLWidget.h>
  43. #include <Inventor/SbColor.h>
  44.  
  45.  
  46. //////////////////////////////////////////////////////////////////////////////
  47. //
  48. //  Class: MyColorPatch
  49. //
  50. //    This class simply draws a 3D looking patch of color.
  51. //
  52. //////////////////////////////////////////////////////////////////////////////
  53.  
  54. // C-api: prefix=SoXtColPatch
  55. class MyColorPatch : public SoXtGLWidget {
  56.  
  57.   public:
  58.     
  59.     MyColorPatch(
  60.     Widget parent = NULL,
  61.     const char *name = NULL, 
  62.     SbBool buildInsideParent = TRUE);
  63.     ~MyColorPatch();
  64.     
  65.     //
  66.     // set/get routines to specify the patch top color
  67.     //
  68.     // C-api: name=setCol
  69.     void        setColor(const SbColor &rgb);
  70.     // C-api: name=getCol
  71.     const SbColor &    getColor()    { return color; }
  72.   
  73.   protected:
  74.  
  75.     // This constructor takes a boolean whether to build the widget now.
  76.     // Subclasses can pass FALSE, then call buildWidget()
  77.     // when they are ready for it to be built.
  78.     SoEXTENDER
  79.     MyColorPatch(
  80.     Widget parent,
  81.     const char *name, 
  82.     SbBool buildInsideParent, 
  83.     SbBool buildNow);
  84.     
  85.   private:
  86.     
  87.     // redefine to do ColorPatch specific things
  88.     virtual void    redraw();
  89.     virtual void    sizeChanged(const SbVec2s &newSize);
  90.     
  91.     // local variables
  92.     SbColor    color;
  93.  
  94.     // this is called by both constructors
  95.     void constructorCommon(SbBool buildNow);
  96. };
  97.  
  98.  
  99. #endif  // _SO_XT_COLOR_PATCH_
  100.